// #####################################
// File     : main.c
// Author   : Chris Meaclem
// Date     : 
// Release  : Intermediate
// Purpose  : 
// Notes    : 
// #####################################

/*Includes:*/
//#include "main.h"
#include "motor.h"

/*END - Includes:*/
/*Definitions:*/


/*END - Definitions:*/
/*Globals:*/
enum vechileStates vechileState_Current = vechile_Stop, vechileState_Next = vechile_Stop;//Declare the current vechile state of the vechile. Use _Next to indicate a change in state is requested.

/*END - Globals:*/


int main (void) 
{
	motor_Init();//Initilise the motor library and associated resources.
	
	vechileState_Next = vechile_Rev;
	
	
	int i = 0;
	while(1)
	{
		
		
		
		
		
		
		/*
		*	Dont make too many succesive calls to the vechile_Drive function. only call when a schange in state is required! Otherwise the wheel rotation is affected.
		*
		*	This should be one of the last functions called:
		*/
		if(vechileState_Current != vechileState_Next)
		{
			//If there has been a request to change state, do so:
			vechile_Drive(vechileState_Next);
			vechileState_Current = vechileState_Next;//Set current to next.
		}
		
		
		
		/*Delay Loop:*/
			i = 0;
			while(i<15000)
			{
				i++;
			}
		/*END - Delay Loop:*/
	}
	
  return 0;
}
